'use strict'

import Router from 'koa-router'
import User from '../app/controllers/user'
import App from '../app/controllers/app'
import Creation from '../app/controllers/creation'

module.exports = () => {
  const router = new Router({
    prefix: '/api/1'
  })

  // user
  router.get('/u/userinfo', User.getUserInfo)
  router.post('/u/verify', App.hasBody, User.verify)
  router.post('/u/signup', App.hasBody, User.signUp)
  router.post('/u/update', App.hasBody, App.hasToken, User.update)

  // app
  router.post('/signature', App.hasBody, App.hasToken, App.signature)
  router.post('/creations', App.hasBody, App.hasToken, Creation.save)
  router.post('/creations/video', App.hasBody, App.hasToken, Creation.video)
  router.post('/creations/audio', App.hasBody, App.hasToken, Creation.audio)

  return router
}
